package com.example.springbootplm.mapper;

import com.example.springbootplm.pojo.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DeptMapper {

    /*查询全部部门信息*/
    @Select("select * from dept")
    List<Dept> list();


    /*根据id删除部门信息*/
    @Delete("delete from dept where id= #{id}")
    void delete(Integer id);

    /*新增部门*/
    @Update("insert into dept (name) values (#{name})")
    void insert(Dept dept);



    /*第一步，根据id查找部门*/
    @Select("select * from dept where id=#{id}")
    Dept selectDeptById(Integer id);

    /*第二步，根据id修改部门*/
    @Update("update dept set name=#{name} where id=#{id}")
    Boolean update(Dept dept);
}
